const container = document.getElementById('tableContainer');
// 定义颜色类数量（与CSS中.color-*对应）
const colorCount = 5;

for (let i = 1; i <= 9; i++) {
    let rowHtml = '';
    for (let j = 1; j <= i; j++) {
        const result = i * j;
        // 随机分配颜色类（1到colorCount之间）
        const randomColor = Math.floor(Math.random() * colorCount) + 1;
        // 每个单元格添加不同的颜色类
        rowHtml += `<div class="cell color-${randomColor}">${j} × ${i} = ${result}</div>`;
    }
    container.innerHTML += `<div>${rowHtml}</div>`;
}